//-------------------------------------------------------------------
//-------------Compress Data Project by RLE. Michael Le--------------
//-------------Version 1.0--------Time :21-09-2014-------------------

#ifndef __COMMON_FILE_H__
#define __COMMON_FILE_H__

#ifdef __cplusplus

#include <fstream>
#include <iostream>
#define mode __cplusplus
using namespace std;

#else

#include "stdio.h"
#define mode CStand

#endif


class CCommonFile
{
public:
	CCommonFile();
	~CCommonFile();
	char* ReadDataFromFile(char* fileName);					// get data of file
	char* CompressFile(char* fileName);
	int WriteDataToFile(char* fileName);
	int WriteDataToFile(char* data, char* fileName);
	int GetSizeFile(char* fileName);															// get size of file

	char* GetData();

private:

	#ifdef mode
	fstream m_file;			// if enviroment is c++, program will read and write by fstream
	#else
	FILE* m_file;			// if enviroment is c, program will read and write by FILE*
	#endif

	char* m_fileName;
	int m_size;
	char* m_DataInFile;
};

#endif